package com.infosys.newSimpleInvertedIndex.entities;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;

import com.baomidou.mybatisplus.annotation.TableField;
import com.infosys.newSimpleInvertedIndex.dto.EmployeeDTOI;
import lombok.*;

/**
 * <p>
 * 员工总表
 * </p>
 *
 * @author Tester
 * @since 2024-06-24
 */
@Data
@Getter
@Setter
@ToString
@AllArgsConstructor
public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    private String name;

    private String govId;

    private String department;

    private LocalDate enrollDate;

    @TableField(exist = false)
    private List<Relative> relatives;

    @TableField(exist = false)
    private Resume resume;

    public Employee(){
        this.id = UUID.randomUUID().toString();
    }

    public Employee(EmployeeDTOI employeeDTOI) {
        this.id = UUID.randomUUID().toString();
        this.name = employeeDTOI.getName();
        this.govId = employeeDTOI.getGovId();
        this.department = employeeDTOI.getDepartment();
        this.enrollDate = employeeDTOI.getEnrollDate().toLocalDate();
    }
}
